package com.mzw.mzw_gateway.config;

import com.google.common.util.concurrent.RateLimiter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author L1nAn
 */

@Configuration
public class GuavaRateLimiterConfig {

    @Bean
    public RateLimiter rateLimiter() {
        /**
         * 每秒钟控制2个请求
         */
        return RateLimiter.create(2);
    }
}
